1 from tkinter import*
2 import tkinter.messagebox as tmsg
3
4
5
6 root = Tk()
7
8 root.geometry("900x500")
9 root.minsize(900,500)
10 root.maxsize(900,500)
11 root.title("Record Manager")
12
13
14 #creating functions
15
16 def submit():
17 with open("record.txt", "a") as f:
18 f.write(f"Username = {nameValue.get()}, Password = {passValue.get()}, Email = {emailValue.get()}, Phone number = {phoneValue.get()}, agreement = {agreementValue.get()}\n")
19
20 def new():
21 pass
22
23 def help():
24 tmsg.showinfo("Help", "This application is developed by Dev!")
25
26 def save():
27 pass
28
29 def saveas():
30 pass
31
32 def exit():
33 a = tmsg.askquestion("Exit?", "Are you sure sir?")
34 if a=="yes":
35 b = tmsg.askquestion("Again!", "Think again sir!")
36 if b=="yes":
37 c = tmsg.askquestion("Again!", "Please, think again sir!")
38 if c=="yes":
39 d = tmsg.askquestion("Again!", "No, think again and again sir!!!!")
40 if d=="yes":
41 tmsg.askquestion("Finally", "Ok OK, you win!")
42 root.destroy()
43 def feedback():
44 l = tmsg.askquestion("Experience", "Was your experience good?")
45
46 if l=="yes":
47 tmsg.showinfo("Yes!", "Good, now go to our official website to rate us!")
48 else:
49 tmsg.showinfo("No!", "Get Lost!")
50
51
52 def update():
53 msg = tmsg.askretrycancel("Sorry!", "Server is busy, so update is not available")
54 if msg:
55 tmsg.showinfo("Sorry", "I already told you, update is not availble, get lost! ")
56 else:
57 tmsg.showinfo("Good", "You are a good person, try later!")
58
59
60 def readme():
61 tmsg.showinfo("ReadMe", "You can see the record in records.txt file in same directory of this application.")
62
63
64 # def size():
65 # size = Tk()
66 # size.geometry("400x300")
67 # size.title("Set your wizard size")
68
69 # def sized():
70 # width = widthValue.get()
71 # height = heightValue.get()
72
73 # root.geometry(f"{width}x{height}")
74
75 # tmsg.showinfo("Size set", "Size is successfully set, according to your choice!")
76 # root.destroy()
77
78 # a = Label(size, text="width")
79 # b = Label(size, text="height")
80
81 # a.grid(row=2, column=3)
82 # b.grid(row=3, column=3)
83
84 # widthValue = StringVar()
85 # heightValue = StringVar()
86
87 # Entry(size, textvariable=widthValue).grid(row=2, column=4)
88 # Entry(size, textvariable=heightValue).grid(row=3, column=4)
89
90 # Button(size, text="Set Size", command=sized).grid(row=4, column=4)
91
92 def color():
93 pass
94
95 def happy():
96 root = Tk()
97 root.geometry("400x100")
98 root.minsize(400,100)
99 root.maxsize(400,100)
100 root.title("Please rate us!")
101
102 def rate():
103
104 tmsg.showinfo("Done", f"Thank You, for rating us {Rate.get()}!")
105
106 with open("rate.txt", "a") as f:
107 f.write(f"Person rated = {Rate.get()}\n")
108
109 root.destroy()
110
111 Rate = Scale(root, from_=0, to=50, tickinterval=10, orient=HORIZONTAL)
112 Rate.pack()
113
114 b0 = Button(root, text="Rate", bg="yellow", command=rate)
115 b0.pack()
116
117
118 #labelling the main components
119 Label (root, text="Kindly fill the following details:-", font="lucida 20 bold", pady=30, bg="yellow" ).grid(row=0, column=4)
120
121 Label(root, text="First name\t \t -", font="lucida 15 bold", padx=10).grid(row=1, column=3)
122 Label(root, text="Surname name\t \t -", font="lucida 15 bold", padx=10).grid(row=2, column=3)
123 Label(root, text="Password\t \t -", font="lucida 15 bold").grid(row=3, column=3)
124 Label(root, text="E-mail address\t \t -", font="lucida 15 bold", padx=10).grid(row=4, column=3)
125 Label(root, text="Phone number\t \t -", font="lucida 15 bold", padx=10).grid(row=5, column=3)
126
127
128 #creating some variable values
129
130 nameValue = StringVar()
131 surnameValue = StringVar()
132 passValue = StringVar()
133 emailValue = StringVar()
134 phoneValue = StringVar()
135 agreementValue = IntVar()
136
137 #checkbutton
138
139 agreement = Checkbutton(text="Have you read our agreement?", variable=agreementValue)
140 agreement.grid(row=6, column=4)
141
142 #creating entry widgets
143
144 Entry(root, textvariable=nameValue).grid(row=1, column=4)
145 Entry(root, textvariable=surnameValue).grid(row=2, column=4)
146 Entry(root, textvariable=passValue).grid(row=3, column=4)
147 Entry(root, textvariable=emailValue).grid(row=4, column=4)
148 Entry(root, textvariable=phoneValue).grid(row=5, column=4)
149
150
151
152 #creating buttons for submission data
153
154 Button(root, text="Submit", command=submit).grid(row=7, column=4)
155
156 #creating menu
157
158 mainmenu = Menu(root)
159 m1 = Menu(mainmenu, tearoff=0)
160 m1.add_command (label="New", command=new)
161 m1.add_command(label="Save", command=save)
162 m1.add_command (label="Save as", command=saveas)
163 m1.add_separator()
164 m1.add_command (label="Exit", command=exit)
165
166 mainmenu.add_cascade(label="File", menu=m1)
167 root.config(menu=mainmenu)
168
169 m2 = Menu(mainmenu, tearoff=0)
170 m2.add_command (label="Help", command=help)
171 m2.add_command (label="Feedback", command=feedback)
172 m2.add_command (label="Update", command=update)
173 m2.add_command (label="See ReadMe", command=readme)
174 m2.add_command (label="Rate", command=happy)
175 mainmenu.add_cascade(label="More", menu=m2)
176
177 m3 = Menu(mainmenu, tearoff=0)
178 # m3.add_command(label="Set Wizard Size", command=size)
179 m3.add_command(label="Set Wizard's Colour", command=color)
180 mainmenu.add_cascade(label="View", menu=m3)
181
182
183
184 root.mainloop()